#!/usr/bin/env perl

package Books;
 
sub new
{
    my $class = shift;
    my $self = {
        _bookName => shift,
        _author   => shift,
        _id       => shift,
    };
    bless $self, $class;
    return $self;
}

sub setBookName {
    my ( $self, $bookName ) = @_;
    $self->{_bookName} = $bookName if defined($bookName);
    return $self->{_bookName};
}
 
sub getBookName {
    my( $self ) = @_;
    return $self->{_bookName};
}
sub info{
    my ($self) = @_;
    print "书名：$self->{_bookName}\n";
    print "作者：$self->{_author}\n";
    print "I D： $self->{_id}\n";
}
sub add {
    my ($self) = @_;
    $self->{_id}++;
}
1;


